 <if condition="$Member neq ''">
<a>
<i class="icon icons2"></i>
  <div class="form_footer">
   <div class="title clearfix">在线留言<img src="{$theme_path}/images/close1.jpg" width="22" height="22"/> </div>
   <form name="mfbform" id="mfbform" onSubmit="return false;" method="post">
  <input type="text" name="realname_s" id="realanme_s" class="text1" autocomplete="off" value="{$Member.nickname}" placeholder="称呼*"/>
  <input type="text" name="phone_s" id="phone_s"  class="text1" autocomplete="off" value="{$Member.phone}"  placeholder="手机号*"/>
  <textarea name="detail_s" id="detail_s" class="text2" autocomplete="off" placeholder="留言内容*"></textarea>
   <input type="hidden" id="container_value" name="picture" size="200">
   <div style="text-align:left">
   <input type="button" class="btn"  id="pickfiles" value="上传图片"/>
   </div>
   <div id="container" style="margin-top:10px;"></div>
  <input type="submit" onclick="member_feedback()" class="sub" value="提交"/>
  </form>
  </div>
  
   <script type="text/javascript">
   	 function member_feedback(){
	var realname = $.trim($("#realanme_s").val());
	var phone = $.trim($("#phone_s").val());
    var detail = $.trim($("#detail_s").val());
	

	if (realname == "") {
		 layer.tips('请输入您的姓名！','#realanme_s' , { time: 1000, tips: [1,'#dd2727'] });
        return;
    }
	
	if (phone == "") {
		 layer.tips('请输入手机号！','#phone_s' , { time: 1000, tips: [1,'#dd2727'] });
        return;
    }
	if(!is_phone(phone)){
	 layer.tips('请输入正确的手机号！','#phone_s' , { time: 1000, tips: [1,'#dd2727'] });
        return;
	}
	if (detail == "") {
		 layer.tips('请输入留言内容！','#detail_s' , { time: 1000, tips: [1,'#dd2727'] });
        return;
    }
	var index = layer.load(0, {shade: [0.5,'#999'] }); //0代表加载的风格，支持0-
    $.ajax({
        url: "{:urlrotue('Ajax/feedback')}",
        data: $("#mfbform").serialize(),
        cache: false,
        type: "POST",
        success: function (obj) {
            if (obj.title == 'success') {
			 layer.closeAll('loading');
			  layer.alert(obj.msg, function(index){
               document.location = "{:urlrotue('/')}";
               layer.close(index);
              });   
               
            }
            else {
				 layer.closeAll('loading');
				layer.msg(obj.msg, {icon: 5}); 
            }
        },
        error: function () {
			 layer.closeAll('loading');
			layer.msg('留言出现错误！', {icon: 5}); 
        }
    });
	
		}
   </script>
   </a>
 <else/>
 <a href="{:urlrotue('Register/login')}">
 <i class="icon icons2"></i>
<div class="shoucan">请先登录</div>
</a>
  </if>             


 <script type="text/javascript">
    $(function () {
     $('.ab1 a i').hover(function () {
    $(this).siblings('.form_footer').addClass('on')
      })
        $('.form_footer .title img').on('click',function () {
         $('.form_footer').removeClass('on');
          })
        })
     </script>

  <!-- jQuery (ZUI中的Javascript组件依赖于jQuery) -->
    <!-- ZUI Javascript组件-->
 <script src="__PUBLIC__/Fwadmin/js/zui.min.js"></script>                       
<script type="text/javascript" src="__PUBLIC__/home/plupload/plupload.full.min.js"></script>
<script type="text/javascript">
    var pickfiles = 'pickfiles';//按钮触发id
    var container = 'container';//图片显示id容器
    var container_value = 'container_value';//图片路径保存id容器
    var max_number = 1;//最多只能上传多少张
    var uploader = new plupload.Uploader({
        runtimes: 'html5',
        browse_button: pickfiles,
        url: "{:U('Upload/uploadfile')}",
        multipart_params: {
            //附加上传参数
            path: 'tuihuan/{:session("member_id")}',
            filetype: 'image'
        },
        chunk_size: '100mb',//最大分片大小
        multi_selection: false,
        filters: {
            max_file_size: '8mb',
            mime_types: [
                {title: "Image files", extensions: "jpg,gif,png,jpeg"},//这里要加上jpeg，因为苹果手机相册里的格式就是这种的
            ]
        },
        resize: {
            //图片压缩处理
            width: 1000,
            crop: false,
            preserve_headers: true
        },
        init: {
            PostInit: function () {
                console.log("upload init");
            },
            FilesAdded: function (up, files) {
                console.log(up.files);
			
                var filesArr = new Array();
                var oldstr = $('#' + container_value).val();
                if (oldstr) {
                    filesArr = $('#' + container_value).val().split(",");
                }
					
                if (filesArr.length >= max_number) { // 最多上传1个文件
                    layer.msg('最多只能上传' + max_number + '张图片', {icon: 5});
                    return;
                }
                //选择文件后直接上传， 或可改成点击按钮上传
                uploader.start();
            },
            UploadProgress: function (up, file) {
                layer.load(1);
            },
            FileUploaded: function (up, file, info) {
               //console.log(info);
                //console.log(info['response']);
                var response = JSON.parse(info['response']);
                //console.log(response['Success']);
				 
                if (response['Success']) {
				
                    $('#' + container).append('<div class="pic" style="margin-right:10px;text-align:left;" savename="' + response['SaveName'] + '"><a href="__ROOT__' + response['SaveName'] + '" target="_blank"><img src="__ROOT__' + response['SaveName'] + '" alt="" width="100"></a><div  class="del" style="text-align:left;margin-left:10px;cursor:pointer; color:#333; font-size:12px;">删除</div></div>');
                    //赋值保存
                    var filesArr = new Array();
                    var oldstr = $('#' + container_value).val();
                    if (oldstr) {
                        filesArr = $('#' + container_value).val().split(",");
                    }
                    filesArr.push(response['SaveName']);
                    $('#' + container_value).val(filesArr.join(','));
                } else {
                    layer.msg('上传出错', {icon: 5});
                }
                layer.closeAll('loading');
            },
            UploadComplete: function (up, files) {
				
                console.log('[完成]');
            },
            Error: function (up, err) {
             
            }
        }
    });
    uploader.init();
</script>
<script>
    $(function () {
		 var delFileUrl="{:U('Upload/delfile')}";//图片删除操作方法
        $('body').on("click", ' .pic .del', function () {
            var filename = $(this).parent('.pic').attr('savename');
            var filesArr = new Array();
            var oldstr = $('#' + container_value).val();
            if (oldstr) {
                filesArr = $('#' + container_value).val().split(",");
                var index = filesArr.indexOf(filename);
                if (index > -1) {
                    filesArr.splice(index, 1);
                }
				
                 if(filename!==''){
					filename_array = filename.split("/");
					var n =filename_array.length-1
					picture_name =filename_array[n];
					
				   $.ajax({
                     url:delFileUrl+"?filename="+picture_name,
                     success:function(val){
						
                   }
                    });
					$('#' + container_value).val(filesArr.join(','));
                    $(this).parent('.pic').remove();
				 }
				
				
                 
                //这里还可以写ajax删除原始图片
            }
        })
    })
	
/*****添加留言******/
function message_submit() {
    var reason = $.trim($("#reason").val());
	var price = $.trim($("#price").val());
    var detail = $.trim($("#detail").val());

	if (reason == "") {
	
		 layer.tips('请选择退款原因', '#reason',{ time: 1000, tips: [2,'#282828'] });
        $("#reason").focus();
        return;
    }
	
	if (price == "") {
	 layer.tips('请输入退款金额', '#price',{ time: 1000, tips: [2,'#282828'] });
        $("#price").focus();
        return;
    }
		

	if (detail == "") {
		 layer.tips('请输入退款说明', '#reason',{ time: 1000, tips: [2,'#282828'] });
        $("#detail").focus();
        return;
    }
	var index = layer.load(0, {shade: [0.5,'#999'] }); //0代表加载的风格，支持0-
    $.ajax({
        url: "{:U('Member/shenqing_tuihuan_submit')}",
        data: $("#frm1").serialize(),
        cache: false,
        type: "POST",
        success: function (obj) {
            if (obj.title == 'success') {
			 layer.closeAll('loading');
			layer.alert(obj.msg, function(index){
               document.location = "{:U('Member/tuihuan')}";
              layer.close(index);
              });   
               
            }
            else {
				 layer.closeAll('loading');
				layer.msg(obj.msg, {icon: 5}); 
            }
        },
        error: function () {
			 layer.closeAll('loading');
			layer.msg('提交出现错误！', {icon: 5}); 
        }
    });
  
}


</script>
